package com.bean.serializabletest.model;

import java.awt.*;
import java.io.Serializable;
import java.util.Map;

/**
 * 作为消息头使用
 */
public class Header{

    /**
     * 校验头
     */
    private int crcCode;

    /**
     * 消息头+消息体总长度
     */
    private int length;

    /**
     * 全局唯一id
     */
    private long sessionId;

    /**
     * 消息类型
     */
    private TrayIcon.MessageType type;

    /**
     * 额外拓展字段
     */
    private Map<String, Object> attachment;

    @Override
    public String toString() {
        return "Header{" +
                "crcCode=" + crcCode +
                ", length=" + length +
                ", sessionId=" + sessionId +
                ", type=" + type +
                ", attachment=" + attachment +
                '}';
    }

    public int getCrcCode() {
        return crcCode;
    }

    public void setCrcCode(int crcCode) {
        this.crcCode = crcCode;
    }

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public long getSessionId() {
        return sessionId;
    }

    public void setSessionId(long sessionId) {
        this.sessionId = sessionId;
    }

    public TrayIcon.MessageType getType() {
        return type;
    }

    public void setType(TrayIcon.MessageType type) {
        this.type = type;
    }

    public Map<String, Object> getAttachment() {
        return attachment;
    }

    public void setAttachment(Map<String, Object> attachment) {
        this.attachment = attachment;
    }
}
